package com.liuhe.test2;

public class Test1 {
    public static void main(String[] args) {
        //捕获分组
        String  regex1 = "(.).+\\1";
        System.out.println("a123a".matches(regex1));
        System.out.println("a123b".matches(regex1));
        System.out.println("------------------------------");
        String regex2 = "(.+).+\\1";
        System.out.println("abc324abc".matches(regex2));
        System.out.println("abc324abd".matches(regex2));
        System.out.println("-----------------------");
        String regex3 = "((.)*).+\\2"; //((.)\\2*).+\\1
        System.out.println("aaanignigaaa".matches(regex3));
        System.out.println("aaanignigaa3".matches(regex3));
        System.out.println("3333nignig3333".matches(regex3));
    }
}
